<template>
	<view class="pages">
		<view class="hedaers">
			<view class="hedaersitems" v-for="(items,index) in ScoreboardTypeData" :key="index"
				:class="[itemsIndex == index ? 'xuanzhong' : '']" @click="select(index)">
				{{items.text}}
			</view>
		</view>
		<CommissionList v-show="itemsIndex == 0" ref="CommissionList"/>
		<CommissionMingXi v-show="itemsIndex == 1" ref="CommissionMingXi"/>
	</view>
</template>

<script>
	// 佣金列表
	import CommissionList from './CommissionList.vue'
	// 佣金明细
	import CommissionMingXi from './CommissionMingXi.vue'
	export default {
		components:{
			CommissionList,
			CommissionMingXi
		},
		data() {
			return {
				itemsIndex: 0,
				ScoreboardTypeData: [{
					id: 0,
					text: this.$t('Commissionlist')
				}, {
					id: 1,
					text: this.$t('CommissionStatements')
				}],
			}
		},
		onLoad() {
			this.$refs.CommissionList.getList()
		},  
		methods: {
			select(index) {
				this.itemsIndex = index
				if(this.itemsIndex == 0 ) {
					this.$refs.CommissionList.getList()
				} else {
					this.$refs.CommissionMingXi.getList()
				}
			},
		}
	}
</script>

<style>
	.pages {
		width: 100%;
		height: 100vh;
		overflow-y: auto;
		background-color: #F0F0F0;
		padding: 0 20rpx;
		box-sizing: border-box;

	}

	.hedaers {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		height: 80rpx;
		border-bottom: 2rpx solid #ccc;
	}

	.hedaersitems {
		line-height: 80rpx;
		text-align: center;
		width: 100%;
		height: 100%;
	}

	.xuanzhong {
		border-bottom: 2rpx solid #273562;
		color: #273562;
	}
</style>